{template header}
<link href="{GODHOUSE_DOMAIN_WWW}css/calendar.css" rel="stylesheet" type="text/css" />
<script language="javascript" type="text/javascript" src="{GODHOUSE_DOMAIN_WWW}js/calendar.js"></script>
<script language="javascript" type="text/javascript" src="{GODHOUSE_DOMAIN_WWW}js/calendar-zh.js"></script>
<script language="javascript">
function AuthenticationRequest(){
	if(J.trim(J('#productNo').val())!=''){
		J.get('product-create.htm?action=Authentication&productNo='+J('#productNo').val()+'&'+Math.random(), function(data){
			if(data=='yes'){
				J('#productNo').next().html('订货号已经存在了！').css('color','red');
			}else{
				J('#productNo').next().html('订货号可以正常使用！').css('color','green');
			}
		});
	}
}
jQuery(function(){

	J('#productNo').bind('keypress', function(){
		AuthenticationRequest();
	}).bind('blur', function(){
		AuthenticationRequest();
	}).bind('keyup', function(){
		AuthenticationRequest();
	});
	
	jQuery('#ispromotions').click(
		function(){
			if(jQuery(this).attr('checked')==true)
			{
				jQuery('#promotionsDisplay').show();
			}
			else
			{
				jQuery('#promotionsDisplay').hide();
			}
		}
	);
	
	var ispromotions = '{$product[ispromotions]}';
	if(ispromotions==1)
	{
		jQuery('#ispromotions').attr('checked', true);
		jQuery('#promotionsDisplay').show();
	}
			  
	jQuery('#startDate').click(function(){showCalendar('startDate');});
	jQuery('#endDate').click(function(){showCalendar('endDate');});

	jQuery('form[name=create]').submit(function(){
		if(jQuery('#brand').val()==0)
		{
			alert('请选择品牌类型');
			jQuery('#brand').focus();
			return false;
		}
		
		if(jQuery('#categoryId').val()==0)
		{
			alert('请选择产品类型');
			jQuery('#categoryId').focus();
			return false;
		}
		
		if(jQuery('#title').val()=='')
		{
			alert('请输入产品标题');
			jQuery('#title').focus();
			return false;
		}
		
		if(jQuery('#ispromotions').attr('checked')==true)
		{
			if(jQuery('#promotionsPrice').val()=='')
			{
				alert('请输入促销价格');
				jQuery('#promotionsPrice').focus();
				return false;
			}
			
			if(jQuery('#startDate').val()=='')
			{
				alert('请选择开始日期');
				jQuery('#startDate').focus();
				return false;
			}
			
			if(jQuery('#endDate').val()=='')
			{
				alert('请选择结束日期');
				jQuery('#endDate').focus();
				return false;
			}
			
		}
		
		if(jQuery('#ourPrice').val()=='')
		{
			alert('请输入市场价格');
			jQuery('#ourPrice').focus();
			return false;
		}
		if(jQuery('#productNo').val()=='')
		{
			alert('请输入订货号');
			jQuery('#productNo').focus();
			return false;
		}
		/*if(jQuery('#martPrice').val()=='')
		{
			alert('请输入市场价格');
			jQuery('#martPrice').focus();
			return false;
		}*/
	
		
	});

});
</script>
<div class="path">
	<span><a href="article-admin.htm">文章管理</a></span>
	<span>{if $_GET['a']=='create'}添加{else}编辑{/if}文章</span>
</div>
<div class="content">
	<div class="c1">
	<form action="article-$action.htm?articleId=$articleId" method="post" enctype="multipart/form-data">
	      <table width="100%" border="0" cellspacing="2" cellpadding="2" style="text-align:center">
	        <tr>
	          <td width="10%" height="30" align="right">类型：</td>
	          <td width="90%" align="left">
	          <select name="article[categoryId]">
			<!--{loop $categoryList $v}-->
				<option value="{$v[categoryId]}" {if $article[categoryId]==$v[categoryId]}selected="selected"{/if}>{$v[cateName]}</option>
				<!--{/loop}-->
	          </select>	          </td>
	        </tr>
	        <tr>
	          <td height="30" align="right">标题：</td>
	          <td align="left"><input type="text" name="article[title]" value="$article[title]" style="width:300px;" /></td>
	        </tr>
	        <tr>
	          <td height="30" align="right">URL跳转：</td>
	          <td align="left"><input type="text" name="article[url]" value="$article[url]" style="width:300px;" /></td>
	        </tr>
	        <tr>
	        	<td height="30" align="right">位置：</td>
	         	<td align="left">
	         		<input type="radio" name="article[position]" value="1" {if $article[position]==1}checked="checked"{/if}/>首页焦点图	         	</td>
	        </tr>
	        <tr>
	          <td height="30" align="right">作者：</td>
	          <td align="left"><input type="text" name="article[author]" value="$article[author]" /></td>
	        </tr>
	        <tr>
	        	<td height="14" align="right">来源：</td>
	          	<td align="left"><input type="text" name="article[source]" value="$article[source]" /></td>
	        </tr>
	        <tr>
	          <td height="14" align="right">时间选择：</td>
              <td align="left"><input name="article[createdTime]" id="startDate" value="$article[createdTime]" type="text" style="width:128px;" />&nbsp;</td>
	        </tr>
	        <tr>
	        	<td height="30" align="right">上传图片：</td>
	          	<td align="left"><input type="file" name="picture" />{if $article[picture]}<a href="$article[picture]" target="_blank">查看原图</a>{/if}
          	    <input name="article[storeId]" type="hidden" id="article[storeId]" value="2"></td>
	        </tr>
	        <tr>
	        	<td height="30" align="right">内容：</td>
	          	<td align="left">
				{eval include("extend/fckeditor/fckeditor.php");
					$sBasePath = "/extend/fckeditor/";
					$oCKeditor = new FCKeditor("article[content]") ;
					$oCKeditor->BasePath = $sBasePath ;
					$oCKeditor->Height='330px';
					$oCKeditor->Width='800px';
					$oCKeditor->Value = $article[content];
					$oCKeditor->Create();	}	          	</td>
	        </tr>
	        <tr>
	          <td height="30" align="right">&nbsp;</td>
	          <td align="left">
			<input type="submit" class="bigButton" name="submitTo" value="  提 交  " />	          </td>
	        </tr>
	      </table>
      </form>
	</div>
</div>
{template footer}